#include <REGX52.H>
#include "key.h"
#include "nixie.h"
#include "Motor.h"
#include "IR.h"

unsigned char command, speed;

void main()
{
	Motor_init();	
	IR_init();
	while(1)
	{
		if(IR_getDataFlag())
		{
			command = IR_getCommand();
			if(command == IR_0){speed = 0;}
			if(command == IR_1){speed = 1;}
			if(command == IR_2){speed = 2;}
			if(command == IR_3){speed = 3;}
			
			// 设置比较值，改变占空比
			if(speed == 0){Motor_setCompare(0);}
			if(speed == 1){Motor_setCompare(50);}
			if(speed == 2){Motor_setCompare(75);}
			if(speed == 3){Motor_setCompare(100);}
		}
		nixieTube(1, speed);
	}
}


